<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head>
<meta name="menu" content="assetMenu" />
<meta name="nav" content="1" />
<meta name="acc" content="detect" />
<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
	<style type="text/css">
	.detect{
	width: 100%;
	}
.detect td{
   	padding:  0.2em 0px 0.2em 8px;
	width: 50px;
}
.detect th{
	
	text-align: center;
}
.detect td input[type="text"] {
   width: 55px;
   text-align: center;
 }
</style>
<script>
	$(document).ready(
			function() {

				$("#reportdate").addClass("Wate").bind("click", function() {
					WdatePicker({
						skin : 'whyGreen',
						minDate : '1900-10-01',
						maxDate : '%y-%M-%d',
						dateFmt : 'yyyy-MM-dd'
					});
				});
				$("#bat").addClass("Wate").bind("click", function() {
						WdatePicker({
							skin : 'whyGreen',
							minDate : '1900-10-01',
							dateFmt : 'yyyy-MM'
						});
				});
				$(function() {
					$("#tabs").tabs();
				});

				var pm2 = [ "#totleRate2", "#countF201", "#countF202",
						"#countF203", "#countF204", "#countF205", "#countF206",
						"#countF207", "#passF201", "#passF202", "#passF203",
						"#passF204", "#passF205", "#passF206", "#passF207" ];
				var pm3 = [ "#totleRate3", "#countF301", "#countF302",
						"#countF303", "#countF304", "#countF305", "#countF306",
						"#countF307", "#countF308", "#countF309", "#countF310",
						"#passF301", "#passF302", "#passF303", "#passF304",
						"#passF305", "#passF306", "#passF307", "#passF308",
						"#passF309", "#passF310" ];
				var pm4 = [ "#totleRate4", "#countF401", "#countF402",
						"#countF403", "#countF404", "#countF405", "#countF406",
						"#countF407", "#passF401", "#passF402", "#passF403",
						"#passF404", "#passF405", "#passF406", "#passF407" ];
				var pm5 = [ "#totleRate5", "#countF501", "#countF502",
						"#countF503", "#passF501", "#passF502", "#passF503" ];
				var pm6 = [ "#totleRate6", "#countF601", "#countF602",
						"#countF603", "#countF604", "#countF605", "#countF606",
						"#countF607", "#countF608", "#countF609", "#countF610",
						"#passF601", "#passF602", "#passF603", "#passF604",
						"#passF605", "#passF606", "#passF607", "#passF608",
						"#passF609", "#passF610" ];
				var pm9 = [ "#totleRate9", "#countF901", "#countF902",
						"#countF903", "#passF901", "#passF902", "#passF903" ];
				$("#inputForm").validate({
					isTip:true,
					rules : {
						
						'structurespot.countF201' : {
							digits : true
						},
						'structurespot.passF201' : {
							digits : true,
							lessThan : [ "#countF201", "#rateF201" ],
							rate : [ "#countF201", "#rateF201" ],
							totleRate : pm2
						},
						'structurespot.countF202' : {
							digits : true
						},
						'structurespot.passF202' : {
							digits : true,
							lessThan : [ "#countF202", "#rateF202" ],
							rate : [ "#countF202", "#rateF202" ],
							totleRate : pm2
						},
						'structurespot.countF203' : {
							digits : true
						},
						'structurespot.passF203' : {
							digits : true,
							lessThan : [ "#countF203", "#rateF203" ],
							rate : [ "#countF203", "#rateF203" ],
							totleRate : pm2
						},
						'structurespot.countF204' : {
							digits : true
						},
						'structurespot.passF204' : {
							digits : true,
							lessThan : [ "#countF204", "#rateF204" ],
							rate : [ "#countF204", "#rateF204" ],
							totleRate : pm2
						},
						'structurespot.countF205' : {
							digits : true
						},
						'structurespot.passF205' : {
							digits : true,
							lessThan : [ "#countF205", "#rateF205" ],
							rate : [ "#countF205", "#rateF205" ],
							totleRate : pm2
						},
						'structurespot.countF206' : {
							digits : true
						},
						'structurespot.passF206' : {
							digits : true,
							lessThan : [ "#countF206", "#rateF206" ],
							rate : [ "#countF206", "#rateF206" ],
							totleRate : pm2
						},
						'structurespot.countF207' : {
							digits : true
						},
						'structurespot.passF207' : {
							digits : true,
							lessThan : [ "#countF207", "#rateF207" ],
							rate : [ "#countF207", "#rateF207" ],
							totleRate : pm2
						},
						'surfacespot.countF301' : {
							digits : true
						},
						'surfacespot.passF301' : {
							digits : true,
							lessThan : [ "#countF301", "#rateF301" ],
							rate : [ "#countF301", "#rateF301" ],
							totleRate : pm3
						},
						'surfacespot.countF302' : {
							digits : true
						},
						'surfacespot.passF302' : {
							digits : true,
							lessThan : [ "#countF302", "#rateF302" ],
							rate : [ "#countF302", "#rateF302" ],
							totleRate : pm3
						},
						'surfacespot.countF303' : {
							digits : true
						},
						'surfacespot.passF303' : {
							digits : true,
							lessThan : [ "#countF303", "#rateF303" ],
							rate : [ "#countF303", "#rateF303" ],
							totleRate : pm3
						},
						'surfacespot.countF304' : {
							digits : true
						},
						'surfacespot.passF304' : {
							digits : true,
							lessThan : [ "#countF304", "#rateF304" ],
							rate : [ "#countF304", "#rateF304" ],
							totleRate : pm3
						},
						'surfacespot.countF305' : {
							digits : true
						},
						'surfacespot.passF305' : {
							digits : true,
							lessThan : [ "#countF305", "#rateF305" ],
							rate : [ "#countF305", "#rateF305" ],
							totleRate : pm3
						},
						'surfacespot.countF306' : {
							digits : true
						},
						'surfacespot.passF306' : {
							digits : true,
							lessThan : [ "#countF306", "#rateF306" ],
							rate : [ "#countF306", "#rateF306" ],
							totleRate : pm3
						},
						'surfacespot.countF307' : {
							digits : true
						},
						'surfacespot.passF307' : {
							digits : true,
							lessThan : [ "#countF307", "#rateF307" ],
							rate : [ "#countF307", "#rateF307" ],
							totleRate : pm3
						},
						'surfacespot.countF308' : {
							digits : true
						},
						'surfacespot.passF308' : {
							digits : true,
							lessThan : [ "#countF308", "#rateF308" ],
							rate : [ "#countF308", "#rateF308" ],
							totleRate : pm3
						},
						'surfacespot.countF309' : {
							digits : true
						},
						'surfacespot.passF309' : {
							digits : true,
							lessThan : [ "#countF309", "#rateF309" ],
							rate : [ "#countF309", "#rateF309" ],
							totleRate : pm3
						},
						'surfacespot.countF310' : {
							digits : true
						},
						'surfacespot.passF310' : {
							digits : true,
							lessThan : [ "#countF310", "#rateF310" ],
							rate : [ "#countF310", "#rateF310" ],
							totleRate : pm3
						},

						'bridgespot.countF401' : {
							digits : true
						},
						'bridgespot.passF401' : {
							digits : true,
							lessThan : [ "#countF401", "#rateF401" ],
							rate : [ "#countF401", "#rateF401" ],
							totleRate : pm4
						},
						'bridgespot.countF402' : {
							digits : true
						},
						'bridgespot.passF402' : {
							digits : true,
							lessThan : [ "#countF402", "#rateF402" ],
							rate : [ "#countF402", "#rateF402" ],
							totleRate : pm4
						},
						'bridgespot.countF403' : {
							digits : true
						},
						'bridgespot.passF403' : {
							digits : true,
							lessThan : [ "#countF403", "#rateF403" ],
							rate : [ "#countF403", "#rateF403" ],
							totleRate : pm4
						},
						'bridgespot.countF404' : {
							digits : true
						},
						'bridgespot.passF404' : {
							digits : true,
							lessThan : [ "#countF404", "#rateF404" ],
							rate : [ "#countF404", "#rateF404" ],
							totleRate : pm4
						},
						'bridgespot.countF405' : {
							digits : true
						},
						'bridgespot.passF405' : {
							digits : true,
							lessThan : [ "#countF405", "#rateF405" ],
							rate : [ "#countF405", "#rateF405" ],
							totleRate : pm4
						},
						'bridgespot.countF406' : {
							digits : true
						},
						'bridgespot.passF406' : {
							digits : true,
							lessThan : [ "#countF406", "#rateF406" ],
							rate : [ "#countF406", "#rateF406" ],
							totleRate : pm4
						},
						'bridgespot.countF407' : {
							digits : true
						},
						'bridgespot.passF407' : {
							digits : true,
							lessThan : [ "#countF407", "#rateF407" ],
							rate : [ "#countF407", "#rateF407" ],
							totleRate : pm4
						},

						'tunnelspot.countF501' : {
							digits : true
						},
						'tunnelspot.passF501' : {
							digits : true,
							lessThan : [ "#countF501", "#rateF501" ],
							rate : [ "#countF501", "#rateF501" ],
							totleRate : pm5
						},
						'tunnelspot.countF502' : {
							digits : true
						},
						'tunnelspot.passF502' : {
							digits : true,
							lessThan : [ "#countF502", "#rateF502" ],
							rate : [ "#countF502", "#rateF502" ],
							totleRate : pm5
						},
						'tunnelspot.countF503' : {
							digits : true
						},
						'tunnelspot.passF503' : {
							digits : true,
							lessThan : [ "#countF503", "#rateF503" ],
							rate : [ "#countF503", "#rateF503" ],
							totleRate : pm5
						},

						'safetyspot.countF601' : {
							digits : true
						},
						'safetyspot.passF601' : {
							digits : true,
							lessThan : [ "#countF601", "#rateF601" ],
							rate : [ "#countF601", "#rateF601" ],
							totleRate : pm6
						},
						'safetyspot.countF602' : {
							digits : true
						},
						'safetyspot.passF602' : {
							digits : true,
							lessThan : [ "#countF602", "#rateF602" ],
							rate : [ "#countF602", "#rateF602" ],
							totleRate : pm6
						},
						'safetyspot.countF603' : {
							digits : true
						},
						'safetyspot.passF603' : {
							digits : true,
							lessThan : [ "#countF603", "#rateF603" ],
							rate : [ "#countF603", "#rateF603" ],
							totleRate : pm6
						},
						'safetyspot.countF604' : {
							digits : true
						},
						'safetyspot.passF604' : {
							digits : true,
							lessThan : [ "#countF604", "#rateF604" ],
							rate : [ "#countF604", "#rateF604" ],
							totleRate : pm6
						},
						'safetyspot.countF605' : {
							digits : true
						},
						'safetyspot.passF605' : {
							digits : true,
							lessThan : [ "#countF605", "#rateF605" ],
							rate : [ "#countF605", "#rateF605" ],
							totleRate : pm6
						},
						'safetyspot.countF606' : {
							digits : true
						},
						'safetyspot.passF606' : {
							digits : true,
							lessThan : [ "#countF606", "#rateF606" ],
							rate : [ "#countF606", "#rateF606" ],
							totleRate : pm6
						},
						'safetyspot.countF607' : {
							digits : true
						},
						'safetyspot.passF607' : {
							digits : true,
							lessThan : [ "#countF607", "#rateF607" ],
							rate : [ "#countF607", "#rateF607" ],
							totleRate : pm6
						},
						'safetyspot.countF608' : {
							digits : true
						},
						'safetyspot.passF608' : {
							digits : true,
							lessThan : [ "#countF608", "#rateF608" ],
							rate : [ "#countF608", "#rateF608" ],
							totleRate : pm6
						},
						'safetyspot.countF609' : {
							digits : true
						},
						'safetyspot.passF609' : {
							digits : true,
							lessThan : [ "#countF609", "#rateF609" ],
							rate : [ "#countF609", "#rateF609" ],
							totleRate : pm6
						},
						'safetyspot.countF610' : {
							digits : true
						},
						'safetyspot.passF610' : {
							digits : true,
							lessThan : [ "#countF610", "#rateF610" ],
							rate : [ "#countF610", "#rateF610" ],
							totleRate : pm6
						},

						'materialspot.countF901' : {
							digits : true
						},
						'materialspot.passF901' : {
							digits : true,
							lessThan : [ "#countF901", "#rateF901" ],
							rate : [ "#countF901", "#rateF901" ],
							totleRate : pm9
						},
						'materialspot.countF902' : {
							digits : true
						},
						'materialspot.passF902' : {
							digits : true,
							lessThan : [ "#countF902", "#rateF902" ],
							rate : [ "#countF902", "#rateF902" ],
							totleRate : pm9
						},
						'materialspot.countF903' : {
							digits : true
						},
						'materialspot.passF903' : {
							digits : true,
							lessThan : [ "#countF903", "#rateF903" ],
							rate : [ "#countF903", "#rateF903" ],
							totleRate : pm9
						}
					},
				 submitHandler: function(inputForm) {
					   batch(inputForm);
					return false;
					 }
				});
			});
</script>
<script>
	$(document).ready(function() {
		var a = "${structurespot.id}";
		if(a==""){
			$("#tabs-1a").hide();
			$("#tabs-1 input").attr("disabled",true);
			$("#tabs-1").hide();
		}
		
		var b = "${surfacespot.id}";
		if(b==""){
			$("#tabs-2a").hide();
			$("#tabs-2 input").attr("disabled",true);
			$("#tabs-2").hide();
		}
		
		var c = "${bridgespot.id}";
		if(c==""){
			$("#tabs-3a").hide();
			$("#tabs-3 input").attr("disabled",true);
			$("#tabs-3").hide();
		}
		
		var d = "${tunnelspot.id}";
		if(d==""){
			$("#tabs-4a").hide();
			$("#tabs-4 input").attr("disabled",true);
			$("#tabs-4").hide();
		}

		var e = "${safetyspot.id}";
		if(e==""){
			$("#tabs-5a").hide();
			$("#tabs-5 input").attr("disabled",true);
			$("#tabs-5").hide();
		}

		var f = "${materialspot.id}";
		if(f==""){
			$("#tabs-6a").hide();
			$("#tabs-6 input").attr("disabled",true);
			$("#tabs-6").hide();
		}
		
		var f = "${pilespot.id}";
		if(f==""){
			$("#tabs-7a").hide();
			$("#tabs-7 input").attr("disabled",true);
			$("#tabs-7").hide();
		}
		
		$(":checkbox").click(function() {
			var raval = $(this).val();
			if ($(this).attr("checked") == true) {
				$("#" + raval + "a").show();
				$("#" + raval).show();
				$("#" + raval + " input").attr("disabled",false);
			} else {
				$("#" + raval + "a").hide();
				$("#" + raval + " input").attr("disabled",true);
				$("#" + raval).hide();
			}
		});
	});
</script>
<script type="text/javascript" >
	$.mask.masks = $.extend($.mask.masks,{
	  msk:{ mask: '999999999999999' },
	  other_msk:{ mask: '9999' }
	  });
  (function($){
      $(function(){
        $('input:text').setMask();
      }
    );
  })(jQuery);
  
  function batch(inputForm) {
	  var bat = $("#bat").val();
	  var ch = $("#ch").val();
	  var signid = $("#signid").val();
	  var batch = bat + ch;
	  $.get("${ctx}/detect/detect!batch.action",
		{oldBatch:'${batch}',oldSignid:'${signid}',
		 batch:batch,signid:signid,
		 projectId:'${projectId}'},function(data){
		  if(data==1){
			  alert("该工程该标段的批次已经存在！请选择不同的批次");
		  }
		  else {
			  inputForm.submit();
		  }
	  });
 }
</script>
</head>
<body>
<form action="detect!save.action" method="post" id="inputForm" name="inputForm"
	class='yform'><input type="hidden" name="projectId"
	value="${projectId }" />
	 <input type="hidden" name="id" value="${id}" />
	 <input type="hidden" name="structurespot.id" value="${structurespot.id}"/>
	 <input type="hidden" name="surfacespot.id" value="${surfacespot.id}"/>
	 <input type="hidden" name="bridgespot.id" value="${bridgespot.id}"/>
	 <input type="hidden" name="tunnelspot.id" value="${tunnelspot.id}"/>
	 <input type="hidden" name="safetyspot.id" value="${safetyspot.id}"/>
	 <input type="hidden" name="materialspot.id" value="${materialspot.id}"/>
	 <input type="hidden" name="pilespot.id" value="${pilespot.id}"/>
<table>
	<tr>
		<td colspan="4">
		<h3>公路工程在建项目质量监督抽检情况信息</h3>
	</tr>
		<tr>
		<td>工程名称</td>
		<td><pt:labels type="proj" argument1="${projectId }" single="true"/></td>
		<td>镇区</td>
		<td>
		<c:forEach items="${autowns}" var="attown">
			<pt:code  category="4419"  code="${attown}"></pt:code>
		</c:forEach>
		<input name="locale" type="hidden" value="<c:forEach items="${autowns}" var="attown"><pt:code  category="4419"  code="${attown}"></pt:code>,</c:forEach>" />
		</td>
	</tr>
	<tr>
		<td>项目属性</td>
		<td><pt:code name="buildKind" category="3002"
			code="${projectInfo.buildKind}"/></td>
		<td>标段</td>
		<td><pt:labels type="sign" argument1="${projectId}"
							name="contract" toScope="request"></pt:labels> 
							<c:if test="${not empty request.contract}">
							<s:select
							name='signid' list="#request.contract" listKey="value"
							listValue="label" emptyOption="true" id="signid" cssClass="required"></s:select>
							</c:if>
							</td>
	</tr>
	<tr>
		<td>行政等级</td>
		<td><pt:code category="3108" name="socialLevel" code="${projectInfo.socialLevel}"></pt:code></td>
		<td>公路等级</td>
		<td><pt:code category="3006"  name="techGrade" code="${projectInfo.techGrade}"></pt:code></td>
	</tr>
	<tr>
		<td>统计人</td>
		<td><input type="hidden" name="reporter" value="${user.userName}"/>${user.userName}</td>
		<td>小组负责人</td>
		<td><input type="text" name="sss" id="ss" /></td>
	</tr>
	<tr>
		<td>批次</td>
		<td><input type="text" name="bat" id="bat" value="${bat }" style="width: 65px" class="required" />
		第<s:select headerValue="1" class="required"   cssStyle="width:60px" list="#{1:'1',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9',10:'10'}"   name="ch" listValue="value" listKey="value" value="ch" id="ch" ></s:select>
		次
		</td>
		<td>统计日期</td>
		<td><input name="reportdate" id="reportdate" readonly="readonly"
			value="${reportdate}" class="required" /></td>
	</tr>
	<tr>
		<td>总工程备注</td>
		<td colspan="3"><textarea rows="3" cols="" name="remark"
			id="remark">${remark}</textarea></td>
	</tr>
	<tr>
		<td>检查内容</td>
		<td colspan="3">
		<input type="checkbox" name="items" id="radio1" value="tabs-1" <c:if test="${not empty structurespot }">checked</c:if> />路基工程&nbsp;&nbsp; 
		<input type="checkbox" name="items"	id="radio2" value="tabs-2" <c:if test="${not empty surfacespot }">checked</c:if> />路面工程&nbsp;&nbsp;
		<input type="checkbox" name="items" id="radio3" value="tabs-3" <c:if test="${not empty tunnelspot }">checked</c:if> />桥梁工程&nbsp;&nbsp; 
		<input type="checkbox" name="items" id="radio4" value="tabs-4" <c:if test="${not empty bridgespot }">checked</c:if> />隧道工程&nbsp;&nbsp;
		<input type="checkbox" name="items" id="radio5" value="tabs-5" <c:if test="${not empty materialspot }">checked</c:if> />安全设施工程&nbsp;&nbsp;
		<input type="checkbox" name="items" id="radio6" value="tabs-6" <c:if test="${not empty safetyspot }">checked</c:if> />三大原材料&nbsp;
		<input type="checkbox" name="items" id="radio7" value="tabs-7" <c:if test="${not empty pilespot }">checked</c:if> />基桩</td>
	</tr>
</table>
<div id="tabs">
<ul>
	<li id="tabs-1a"><a href="#tabs-1">路基监督抽检</a></li>
	<li id="tabs-2a"><a href="#tabs-2">路面监督抽检</a></li>
	<li id="tabs-3a"><a href="#tabs-3">桥梁监督抽检</a></li>
	<li id="tabs-4a"><a href="#tabs-4">隧道监督抽检</a></li>
	<li id="tabs-5a"><a href="#tabs-5">安全设施抽检</a></li>
	<li id="tabs-6a"><a href="#tabs-6">三大原材料监督抽检</a></li>
	<li id="tabs-7a"><a href="#tabs-7">基桩</a></li>
</ul>

<div id="tabs-1"><jsp:include page="structurespot_input.jsp"></jsp:include>
</div>

<div id="tabs-2"><jsp:include page="surfacespot_input.jsp"></jsp:include>
</div>

<div id="tabs-3"><jsp:include page="bridgespot_input.jsp"></jsp:include>
</div>

<div id="tabs-4"><jsp:include page="tunnelspot_input.jsp"></jsp:include>
</div>

<div id="tabs-5"><jsp:include page="safetyspot_input.jsp"></jsp:include>
</div>

<div id="tabs-6"><jsp:include page="materialspot_input.jsp"></jsp:include>
</div>

<div id="tabs-7"><jsp:include page="pilespot_input.jsp"></jsp:include>
</div>

<div class="type-button"><input type="submit" id="submitbtn"
	class="submit" value="提交" />&nbsp; <input type="button" value="返回"
	class="reset" onclick="history.back()" /></div>
</div>
</form>
</body>
